import cv2


img = cv2.imread('1.jpg')
top_size, bottom_size, left_size, right_size  = (50,50,50,50)

# ## 复制填充
# # replicate = cv2.copyMakeBorder(img, top_size, bottom_size, left_size, right_size, cv2.BORDER_REPLICATE)
# # cv2.imshow('original', img)
# # cv2.imshow('replicate', replicate)
#
# ## 反射填充 不反射边框的像素
# reflect = cv2.copyMakeBorder(img, top_size, bottom_size, left_size, right_size, cv2.BORDER_REFLECT_101)
# cv2.imshow('original', img)
# cv2.imshow('replicate', reflect)
#
# cv2.waitKey(0)

## 反射填充 反射边框的像素
# reflect = cv2.copyMakeBorder(img, top_size, bottom_size, left_size, right_size, cv2.BORDER_REFLECT)
# cv2.imshow('original', img)
# cv2.imshow('replicate', reflect)
#
# cv2.waitKey(0)


reflect = cv2.copyMakeBorder(img, top_size, bottom_size, left_size, right_size, cv2.BORDER_WRAP)
cv2.imshow('original', img)
cv2.imshow('replicate', reflect)

cv2.waitKey(0)